
//主类
export class liquidFunHandle {

    private static _instance: liquidFunHandle;


    //主世界
    private _mianWorld: b2.World

    private _particleSystem: b2.ParticleSystem


    public static get Instance(): liquidFunHandle {
        if (!liquidFunHandle._instance) {
            liquidFunHandle._instance = new liquidFunHandle();
        }
        return liquidFunHandle._instance;
    }


    InitMainWorld(gravity: b2.Vec2) {
        // this._mianWorld = new b2World(gravity);
        // window["world"] = this._mianWorld;

        const phyMgr = cc.director.getPhysicsManager();
        const world = phyMgr['_world'];
        this._mianWorld = world;
        window["world"] = this._mianWorld;
    }



    public get MianWorld(): b2.World {
        return this._mianWorld;
    }


    /**粒子系统 */
    public get MianparticleSystem(): b2.ParticleSystem {
        return this._particleSystem;
    }

    /**粒子系统 */
    public set MianparticleSystem(sys: b2.ParticleSystem) {
        this._particleSystem = sys;
    }

    convertToPWorld(pos): any {
        return new b2.Vec2(pos.x / 32, pos.y / 32);
    }

}